monthSelect = Ext.extend(Ext.form.ComboBox, {
    fieldLabel: 'Month',
    name: 'month',
    width: 125,
    forceSelection: true,
    triggerAction: 'all', // will display all options
    value: 1, // default value
    store: [
            [1,"Jan"], 
            [2, "Feb"], 
            [3, "Mar"], 
            [4, "Apr"],
            [5, "May"],
            [6, "Jun"],
            [7, "Jul"],
            [8, "Aug"],
            [9, "Sep"],
            [10, "Oct"],
            [11, "Nov"],
            [12, "Dec"]]
}); // end .extend



levelSelect = Ext.extend(Ext.form.ComboBox, {
    fieldLabel: 'Level',
    name: 'frztype',
    width: 125,
    forceSelection: true,
    triggerAction: 'all', // will display all options
    value: 0, // default value
    store: [
            [0,"0 C"], 
            [1, "10 C"], 
            [2, "20 C"], 
            [3, "30 C"]]
}); // end .extend

PrecipLevelSelect = Ext.extend(Ext.form.ComboBox, {
    fieldLabel: 'Level',
    name: 'level',
    width: 125,
    forceSelection: true,
    triggerAction: 'all', // will display all options
    value: 0, // default value
    store: [
            [0, "0 m"],
            [1, "200 m"],
            [2, "400 m"],
            [3, "600 m"],
            [4, "800 m"],
            [5, "1000 m"],
            [6, "1200 m"],
            [7, "1400 m"],
            [8, "1600 m"],
            [9, "1800 m"],
            [10, "2000 m"],
            [11, "2200 m"],
            [12, "2400 m"],
            [13, "2600 m"],
            [14, "2800 m"],
            [15, "3000 m"],
            [16, "3200 m"],
            [17, "3400 m"],
            [18, "3600 m"],
            [19, "3800 m"],
            [20, "4000 m"]]
}); // end .extend

spanSelect = Ext.extend(Ext.form.ComboBox, {
    fieldLabel: 'Span',
    name: 'span',
    width: 125,
    forceSelection: true,
    triggerAction: 'all', // will display all options
    value: 1, // default value
    store: [
            [1,"1 Month"], 
            [2,"2 Months"], 
            [3,"3 Months"], 
            [4,"4 Months"], 
            [5,"5 Months"], 
            [6,"6 Months"], 
            [7,"7 Months"], 
            [8,"8 Months"], 
            [9,"9 Months"], 
            [10,"10 Months"], 
            [11,"11 Months"], 
            [12,"12 Months"], 
            [13,"13 Months"], 
            [14,"14 Months"], 
            [15,"15 Months"], 
            [16,"16 Months"], 
            [17,"17 Months"], 
            [18,"18 Months"], 
            [19,"19 Months"], 
            [20,"20 Months"], 
            [21,"21 Months"], 
            [22,"22 Months"], 
            [23,"23 Months"], 
            [24,"24 Months"]] 
}); // end .extend

yearsSelect = Ext.extend(Ext.form.ComboBox, {
    fieldLabel: 'Years',
    name: 'years',
    width: 125,
    forceSelection: true,
    triggerAction: 'all', // will display all options
    value: 0, // default value
    store: [
            [0,"None"], 
            [1,"1 Year"], 
            [2,"2 Years"], 
            [3,"3 Years"], 
            [4,"4 Years"], 
            [5,"5 Years"], 
            [6,"6 Years"], 
            [7,"7 Years"], 
            [8,"8 Years"], 
            [9,"9 Years"], 
            [10,"10 Years"], 
            [11,"11 Years"], 
            [12,"12 Years"], 
            [13,"13 Years"], 
            [14,"14 Years"], 
            [15,"15 Years"], 
            [16,"16 Years"], 
            [17,"17 Years"], 
            [18,"18 Years"], 
            [19,"19 Years"], 
            [20,"20 Years"], 
            [21,"21 Years"], 
            [22,"22 Years"], 
            [23,"23 Years"], 
            [24,"24 Years"]] 
}); // end .extend


unitsSelect = Ext.extend(Ext.form.ComboBox, {
    fieldLabel: 'Units',
    name: 'units',
    width: 125,
    forceSelection: true,
    triggerAction: 'all', // will display all options
    value: 'm', // default value
    store: [
            ['m',"meters"], 
            ['ft', "feet"]]
}); // end .extend


latlonInput = Ext.extend(Ext.form.Field, {
}); // end .extend


newPanelSubmit = Ext.extend(Ext.Button, {
    text: "Submit",
    params: {},
    src: '',
    handler: function() {
        var p = Ext.getCmp('id_product_tabs');
        var product = p.layout.activeItem;
        var params = this.params;
        var src = this.src;
        var formelements = product.findBy(function(){ return this.name != null });

        for ( var i=0; i<formelements.length; i++ ) {
            var f = formelements[i];
            params[f.name] = f.getValue();
        }

        var newpanel = new Ext.Panel({
                title: parseFloat(params.lat).toFixed(2) +"N, "+ (Math.abs(params.lon)).toFixed(2) +"W",
                closable: true,
                autoScroll: true,
                autoLoad: {
                    url: src,
                    params: params,
                    method: 'GET'
                }
            });
        panels.add(newpanel);
        panels.activate(newpanel);
    }
}); // end .extend


helpWindowButton = Ext.extend(Ext.Button, {
    text: "Help",
    handler: function() {
        var w = new Ext.Window({
            autoScroll: true,
            width: this.winWidth || 500,
            height: this.winHeight || 400,
            //plain: true,
            closeAction: 'hide',
            contentEl: this.contentEl
        });
        w.show()
    } // end handler function
}); // end .extend
